select B.field0001 AS "客户编号",F.field0009 as "营业组织",A.field0041 AS "金额",M.SHOWVALUE AS "风险类型",
to_char(A.field0036,'yyyyMMdd') AS "有效日期",A.field0004 AS DJBH,A.field0088 AS BT,A.field0087 AS"销售办事处",
T.NAME as DEPTNAME,E."company"as ADDRESS,D.NAME AS USERNAME
from
formmain_0119 A
LEFT OUTER JOIN formmain_0176 B ON B.field0001 =A.field0037
LEFT OUTER JOIN ORG_MEMBER D ON D."ID" = A.field0001
LEFT OUTER JOIN "temp_org_member_group" E ON D."ID" = E."member_id"
LEFT outer JOIN ORG_UNIT T ON D.ORG_DEPARTMENT_ID = T."ID"
LEFT OUTER JOIN formmain_0180 F ON A.field0087=F.field0001 AND A.field0039=F.field0005
LEFT OUTER JOIN CTP_ENUM_ITEM M ON  A.field0044=M.ID
where A.ID=?